{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "f71a41bd",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "arr = np.arange(12)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "8809a0be",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0,  1,  2,  3],\n",
       "       [ 4,  5,  6,  7],\n",
       "       [ 8,  9, 10, 11]])"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr=arr.reshape(3,4)\n",
    "arr"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "49474e9b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([4, 5, 6, 7])"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr[1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "5eaea619",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "6"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr[1][2]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "4caef597",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 5,  6],\n",
       "       [ 9, 10]])"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "temp=arr[1:3,1:3]\n",
    "temp"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "10d23ce0",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "5"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr[1,1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "fe9b0870",
   "metadata": {},
   "outputs": [],
   "source": [
    "temp[1][1]=9"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "a1666e52",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[5, 6],\n",
       "       [9, 9]])"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "temp"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "26794e1f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0,  1,  2,  3],\n",
       "       [ 4,  5,  6,  7],\n",
       "       [ 8,  9,  9, 11]])"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "f911bd5a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0,  1,  2,  3],\n",
       "       [ 4,  5,  6,  7],\n",
       "       [ 8,  9, 10, 11]])"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a = np.arange(12)\n",
    "a=a.reshape(3,4)\n",
    "a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "e0339999",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 5,  6],\n",
       "       [ 9, 10]])"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "temp=np.copy(a[1:3,1:3])\n",
    "temp"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "3d58ce85",
   "metadata": {},
   "outputs": [],
   "source": [
    "temp[1][1]=9"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "bdc1f1d3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[5, 6],\n",
       "       [9, 9]])"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "temp"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "3aa5a8fe",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0,  1,  2,  3],\n",
       "       [ 4,  5,  6,  7],\n",
       "       [ 8,  9, 10, 11]])"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "7ec274a5",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0,  1,  2],\n",
       "       [ 3,  4,  5],\n",
       "       [ 6,  7,  8],\n",
       "       [ 9,  9, 11]])"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr.reshape(4,3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "75e44a4e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0,  1,  2,  3,  4,  5],\n",
       "       [ 6,  7,  8,  9,  9, 11]])"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr.reshape(2,6)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "53e88299",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9,  9, 11])"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr.ravel()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "d7825014",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[[ 0,  1],\n",
       "        [ 2,  3],\n",
       "        [ 4,  5]],\n",
       "\n",
       "       [[ 6,  7],\n",
       "        [ 8,  9],\n",
       "        [ 9, 11]]])"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr.reshape(2,3,2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "f712c78f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9,  9, 11])"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr.flatten()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "1ee60e66",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9,  9, 11])"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr.ravel()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "id": "118cbcfb",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[1, 2, 3],\n",
       "       [4, 5, 6]])"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a=np.array([[1,2,3],[4,5,6]])\n",
    "a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "id": "31b2df63",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([['a', 'b', 'c'],\n",
       "       ['d', 'e', 'f']], dtype='<U1')"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "b=np.array([[\"a\",'b','c'],['d','e','f']])\n",
    "b"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "id": "938bac84",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([['1', '2', '3', 'a', 'b', 'c'],\n",
       "       ['4', '5', '6', 'd', 'e', 'f']], dtype='<U11')"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.hstack([a,b])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "id": "2dee694e",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([['1', '2', '3'],\n",
       "       ['4', '5', '6'],\n",
       "       ['a', 'b', 'c'],\n",
       "       ['d', 'e', 'f']], dtype='<U11')"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.vstack([a,b])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "id": "dee1c0e3",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0,  1,  2,  3],\n",
       "       [ 4,  5,  6,  7],\n",
       "       [ 8,  9, 10, 11]])"
      ]
     },
     "execution_count": 56,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a_x=np.arange(12).reshape(3,4)\n",
    "a_x"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "id": "36d11416",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11],\n",
       "       [12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23],\n",
       "       [24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35]])"
      ]
     },
     "execution_count": 57,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "b_x=np.arange(36).reshape(3,12)\n",
    "b_x"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "id": "b25cf04b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0,  1,  2,  3,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11],\n",
       "       [ 4,  5,  6,  7, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23],\n",
       "       [ 8,  9, 10, 11, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35]])"
      ]
     },
     "execution_count": 58,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.hstack([a_x,b_x])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "id": "39c11bac",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[[ 1,  2,  3,  4],\n",
       "        [ 5,  6,  7,  8],\n",
       "        [ 9, 10, 11, 12]],\n",
       "\n",
       "       [[13, 14, 15, 16],\n",
       "        [17, 18, 19, 20],\n",
       "        [21, 22, 23, 24]],\n",
       "\n",
       "       [[25, 26, 27, 28],\n",
       "        [29, 30, 31, 32],\n",
       "        [33, 34, 35, 36]]])"
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "aa=np.arange(1,37).reshape(3,3,4)\n",
    "aa"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 76,
   "id": "ab3a25b2",
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[[101, 102, 103, 104],\n",
       "        [105, 106, 107, 108],\n",
       "        [109, 110, 111, 112]],\n",
       "\n",
       "       [[113, 114, 115, 116],\n",
       "        [117, 118, 119, 120],\n",
       "        [121, 122, 123, 124]],\n",
       "\n",
       "       [[125, 126, 127, 128],\n",
       "        [129, 130, 131, 132],\n",
       "        [133, 134, 135, 136]]])"
      ]
     },
     "execution_count": 76,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "bb=np.arange(101,137).reshape(3,3,4)\n",
    "bb"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 77,
   "id": "d9ede359",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[[  1,   2,   3,   4],\n",
       "        [  5,   6,   7,   8],\n",
       "        [  9,  10,  11,  12]],\n",
       "\n",
       "       [[ 13,  14,  15,  16],\n",
       "        [ 17,  18,  19,  20],\n",
       "        [ 21,  22,  23,  24]],\n",
       "\n",
       "       [[ 25,  26,  27,  28],\n",
       "        [ 29,  30,  31,  32],\n",
       "        [ 33,  34,  35,  36]],\n",
       "\n",
       "       [[101, 102, 103, 104],\n",
       "        [105, 106, 107, 108],\n",
       "        [109, 110, 111, 112]],\n",
       "\n",
       "       [[113, 114, 115, 116],\n",
       "        [117, 118, 119, 120],\n",
       "        [121, 122, 123, 124]],\n",
       "\n",
       "       [[125, 126, 127, 128],\n",
       "        [129, 130, 131, 132],\n",
       "        [133, 134, 135, 136]]])"
      ]
     },
     "execution_count": 77,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.concatenate([aa,bb],axis=0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "id": "2393f7c1",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(6, 3, 4)"
      ]
     },
     "execution_count": 72,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.concatenate([aa,bb],axis=0).shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "id": "cdfdb65e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[[  1,   2,   3,   4],\n",
       "        [  5,   6,   7,   8],\n",
       "        [  9,  10,  11,  12],\n",
       "        [101, 102, 103, 104],\n",
       "        [105, 106, 107, 108],\n",
       "        [109, 110, 111, 112]],\n",
       "\n",
       "       [[ 13,  14,  15,  16],\n",
       "        [ 17,  18,  19,  20],\n",
       "        [ 21,  22,  23,  24],\n",
       "        [113, 114, 115, 116],\n",
       "        [117, 118, 119, 120],\n",
       "        [121, 122, 123, 124]],\n",
       "\n",
       "       [[ 25,  26,  27,  28],\n",
       "        [ 29,  30,  31,  32],\n",
       "        [ 33,  34,  35,  36],\n",
       "        [125, 126, 127, 128],\n",
       "        [129, 130, 131, 132],\n",
       "        [133, 134, 135, 136]]])"
      ]
     },
     "execution_count": 73,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.concatenate([aa,bb],axis=1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "id": "67bf6291",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[[  1,   2,   3,   4, 101, 102, 103, 104],\n",
       "        [  5,   6,   7,   8, 105, 106, 107, 108],\n",
       "        [  9,  10,  11,  12, 109, 110, 111, 112]],\n",
       "\n",
       "       [[ 13,  14,  15,  16, 113, 114, 115, 116],\n",
       "        [ 17,  18,  19,  20, 117, 118, 119, 120],\n",
       "        [ 21,  22,  23,  24, 121, 122, 123, 124]],\n",
       "\n",
       "       [[ 25,  26,  27,  28, 125, 126, 127, 128],\n",
       "        [ 29,  30,  31,  32, 129, 130, 131, 132],\n",
       "        [ 33,  34,  35,  36, 133, 134, 135, 136]]])"
      ]
     },
     "execution_count": 68,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.concatenate([aa,bb],axis=2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "id": "98d34301",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(3, 3, 8)"
      ]
     },
     "execution_count": 69,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.concatenate([aa,bb],axis=2).shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 70,
   "id": "70c22d90",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[[  1,   2,   3,   4],\n",
       "        [  5,   6,   7,   8],\n",
       "        [  9,  10,  11,  12],\n",
       "        [101, 102, 103, 104],\n",
       "        [105, 106, 107, 108],\n",
       "        [109, 110, 111, 112]],\n",
       "\n",
       "       [[ 13,  14,  15,  16],\n",
       "        [ 17,  18,  19,  20],\n",
       "        [ 21,  22,  23,  24],\n",
       "        [113, 114, 115, 116],\n",
       "        [117, 118, 119, 120],\n",
       "        [121, 122, 123, 124]],\n",
       "\n",
       "       [[ 25,  26,  27,  28],\n",
       "        [ 29,  30,  31,  32],\n",
       "        [ 33,  34,  35,  36],\n",
       "        [125, 126, 127, 128],\n",
       "        [129, 130, 131, 132],\n",
       "        [133, 134, 135, 136]]])"
      ]
     },
     "execution_count": 70,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.hstack([aa,bb])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "e70f3ac1",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "my_test",
   "language": "python",
   "name": "my_test"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
